USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[CapturesSelectTop5Players]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.CapturesSelectTop5Players
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/03/08
-- Description:	Captures Table Select - Top 5 Captures
-- =============================================
CREATE PROCEDURE CapturesSelectTop5Players
	
AS

BEGIN

SELECT Top 5 PlayerName, COUNT(CaptureList.PlayerId) AS [Captures], CaptureList.PlayerId
FROM CaptureList INNER JOIN PlayerNameList on CaptureList.PlayerId = PlayerNameList.PlayerId
GROUP BY CaptureList.PlayerId, PlayerName
ORDER BY [Captures] DESC

END
GO



--  CapturesSelectTop5Players
